#include<iostream>
using namespace std;
int Judge(int n)
{
    for(int i=2;i<=n/2;i++)
        if(n%i==0)
        return 0;
        return 1;
}
int main()
{
    int n=0;
 	for(int i=2;i<=1000;i++){
		if(Judge(i)){
        cout<<i<<" ";
        n++;
        if(n%5!=0)
            continue;
        cout<<endl;
		}
 	}
}

